package top.likeqc.leetcode.editor.cn;

/**
 * @see <a href="https://leetcode.cn/problems/best-poker-hand">2347. 最好的扑克手牌</a>
 */
public class BestPokerHand {
    public static void main(String[] args) {
        Solution solution = new BestPokerHand().new Solution();
    }
    // leetcode submit region begin(Prohibit modification and deletion)
    class Solution {
        public String bestHand(int[] ranks, char[] suits) {
            if (suits[0] == suits[1]
                    && suits[1] == suits[2]
                    && suits[2] == suits[3]
                    && suits[3] == suits[4]) {
                return "Flush";
            }
            int[] a = new int[16];
            int max = -1;
            for (int rank : ranks) {
                a[rank]++;
                max = Math.max(a[rank], max);
            }
            if (max >= 3) {
                return "Three of a Kind";
            } else if (max == 2) {
                return "Pair";
            } else {
                return "High Card";
            }
        }
    }
    // leetcode submit region end(Prohibit modification and deletion)

}
